/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * AccInfoMenuPanel.java
 *
 * Created on 22-Mar-2011, 9:44:01 PM
 */

package com.inse6260.atms.view;

import com.inse6260.atms.controller.ATMSController;

/**
 *
 * @author dimitri.tiago
 */
public class AccInfoMenuPanel extends javax.swing.JPanel
{
    private ATMSController atmsController;

    /** Creates new form AccInfoMenuPanel */
    public AccInfoMenuPanel(ATMSController atmsController)
    {
        initComponents();

        this.atmsController = atmsController;
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jLabel1 = new javax.swing.JLabel();
        accStateButton = new javax.swing.JButton();
        jButton1 = new javax.swing.JButton();
        jButton2 = new javax.swing.JButton();

        setBorder(new javax.swing.border.LineBorder(new java.awt.Color(0, 0, 0), 1, true));

        jLabel1.setFont(new java.awt.Font("Tahoma", 1, 18));
        jLabel1.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        jLabel1.setText("Please select an option.");

        accStateButton.setText("> Account Statement");
        accStateButton.setHorizontalAlignment(javax.swing.SwingConstants.LEADING);
        accStateButton.setHorizontalTextPosition(javax.swing.SwingConstants.LEADING);
        accStateButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                AccInfoMenuPanel.this.actionPerformed(evt);
            }
        });

        jButton1.setText("> Account Balance");
        jButton1.setHorizontalAlignment(javax.swing.SwingConstants.LEADING);
        jButton1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                AccInfoMenuPanel.this.actionPerformed(evt);
            }
        });

        jButton2.setText("> Accounts List");
        jButton2.setHorizontalAlignment(javax.swing.SwingConstants.LEADING);
        jButton2.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                AccInfoMenuPanel.this.actionPerformed(evt);
            }
        });

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
        this.setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addGap(10, 10, 10)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.CENTER)
                    .addComponent(accStateButton, javax.swing.GroupLayout.PREFERRED_SIZE, 167, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel1, javax.swing.GroupLayout.DEFAULT_SIZE, 380, Short.MAX_VALUE)
                    .addComponent(jButton2, javax.swing.GroupLayout.PREFERRED_SIZE, 167, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jButton1, javax.swing.GroupLayout.PREFERRED_SIZE, 167, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(10, 10, 10))
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addGap(60, 60, 60)
                .addComponent(jLabel1)
                .addGap(37, 37, 37)
                .addComponent(jButton1)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(jButton2)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(accStateButton)
                .addContainerGap(88, Short.MAX_VALUE))
        );
    }// </editor-fold>//GEN-END:initComponents

    private void actionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_actionPerformed

        String selection = evt.getActionCommand();

        // if account balance selected
        if (selection.equalsIgnoreCase("> Account Balance"))
        {
            atmsController.setCurrTransParams("balance", "balance");
            atmsController.showAccSelPanel();
        }

        // if account balance selected
        if (selection.equalsIgnoreCase("> Accounts List"))
        {
            atmsController.setCurrTransParams("accList", "accList");
            atmsController.showNextPanel();
        }

        // if account statement selected
        if (selection.equalsIgnoreCase("> Account Statement"))
        {
            atmsController.setCurrTransParams("statement", "statement");
            atmsController.showAccSelPanel();
        }
    }//GEN-LAST:event_actionPerformed


    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton accStateButton;
    private javax.swing.JButton jButton1;
    private javax.swing.JButton jButton2;
    private javax.swing.JLabel jLabel1;
    // End of variables declaration//GEN-END:variables

}
